<template>
	<view class="beijingse1">
		<!-- 头部 -->
		<view class="tobejt" v-if="!is_login">
			<view class="flexbetween" @click="login">
				<view class="flexleft">
					<view class="shilitu margin_right2">
						<image src="../../static/image/system/wdl.png" mode=""></image>
					</view>
					<view class="bigtext1212">未登录</view>
				</view>
				<view class="righticon1"></view>
			</view>
		</view>
		<view class="tobejt" @click="tzgrxx" v-if="is_login">
			<view class="flexbetween">
				<view class="flexleft">
					<view class="shilitu margin_right2">
						<image :src="personInfo.avatar_text" mode=""></image>
					</view>
					<view class="">
						<view class="flexleft">
							<view class="bigtext margin_right2">{{personInfo.nickname}}</view>
							<view class="fwzxbtn">{{personInfo.usersf.name}}</view>
						</view>
						<view class="flexleft margin_top1">
							<view class="nostrongtext margin_right2">邀请码：{{personInfo.invite_code}}</view>
							<view class="fuzhi" @click.stop="fuzhi"></view>
						</view>
						<view class="nostrongtext margin_top1" @click.stop="tzwdgz">关注{{personInfo.shopgz}}</view>
					</view>
				</view>
				<view class="righticon1"></view>
			</view>
		</view>
		<!-- 内容 -->
		<view class="neirong mainpadding">
			<view class="ffffff radius mainpadding">
				<view class="xiahuax flexbetween" @click="tzwddd(1)">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/wddd.png" mode=""></image>
						</view>
						<view class="titletext">普通商城订单</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<view :class="personInfo.shopapply?'xiahuax flexbetween margin_top':'flexbetween margin_top'" @click="tzwddd(2)">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/sjrz.png" mode=""></image>
						</view>
						<view class="titletext">福利券专区订单</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<template v-if="personInfo.shopapply">
					<view class=" flexbetween margin_top" @click="tzwddp" v-if="personInfo.shopapply.status==2">
						<view class="flexleft">
							<view class="tubiao margin_right2">
								<image src="../../static/image/system/wddp.png" mode=""></image>
							</view>
							<view class="titletext">我的店铺</view>
						</view>
						<view class="righticon1"></view>
					</view>
				</template>
				
			</view>
			<view class="ffffff radius mainpadding margin_top">
				<view class="xiahuax flexbetween" @click="tzwdzh">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/wdzh.png" mode=""></image>
						</view>
						<view class="titletext">我的账户</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<view class="xiahuax flexbetween margin_top" @click="tzyqhy">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/yqhy.png" mode=""></image>
						</view>
						<view class="titletext">邀请好友</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<view class="xiahuax flexbetween margin_top" @click="tzwdtd">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/wdtd.png" mode=""></image>
						</view>
						<view class="titletext">我的团队</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<view class="xiahuax flexbetween margin_top" v-if="personInfo.usersf.id==3||personInfo.usersf.id==4||personInfo.is_area_dl" @click="tzfwzx">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/csdl.png" mode=""></image>
						</view>
						<view v-if="personInfo.usersf.id==3" class="titletext">服务中心</view>
						<view v-else-if="personInfo.usersf.id==4" class="titletext">运营中心</view>
						<view v-if="personInfo.is_area_dl" class="titletext">城市代理</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<!-- <view class="xiahuax flexbetween margin_top" v-if="personInfo.is_area_dl" @click="tzcsdl">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/csdl.png" mode=""></image>
						</view>
						<view class="titletext">城市代理</view>
					</view>
					<view class="righticon1"></view>
				</view> -->
				<view class="xiahuax flexbetween margin_top" @click="tzwdycst">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/wdytsc.png" mode=""></image>
						</view>
						<view class="titletext">我的云创生态</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<view class="xiahuax flexbetween margin_top" @click="tzsjrz">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/sjrz.png" mode=""></image>
						</view>
						<view class="titletext">商家入驻</view>
					</view>
					<view class="righticon1"></view>
				</view>
				<view class=" flexbetween margin_top" @click="tzsz">
					<view class="flexleft">
						<view class="tubiao margin_right2">
							<image src="../../static/image/system/shezhi.png" mode=""></image>
						</view>
						<view class="titletext">设置</view>
					</view>
					<view class="righticon1"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				personInfo: {
					shopapply:{},
					is_area_dl:false,
					usersf:{}
				},
				is_login: false,
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			}
		},
		methods: {
			
			init() {
				httpRequest.request('/api/user/index', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.personInfo = res.data
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			// 跳转邀请好友
			tzyqhy() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/yaoqhy'
				})
			},
			// 跳转设置
			tzsz() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/shezhi'
				})
			},
			// 跳转我的云创生态
			tzwdycst() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/wdycst'
				})
			},
			// 跳转商家入驻
			tzsjrz() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				if(this.personInfo.shopapply){
					uni.navigateTo({
						url: '/pages/mypage/shenheshangjrz'
					})
				}else{
					uni.navigateTo({
						url: '/pages/mypage/shangjrz'
					})
				}
				
			},
			// 跳转我的账户
			tzwdzh() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/wodezhangh'
				})
			},
			// 跳转我的团队
			tzwdtd() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/wodetd'
				})
			},
			// 跳转服务中心
			tzfwzx(){
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/fuwuzx?user_sf_id='+this.personInfo.user_sf_id+'&is_area_dl='+this.personInfo.is_area_dl
				})
			},
			// 跳转城市代理	
			tzcsdl(){
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/chengshidl'
				})
			},
			// 跳转我的店铺
			tzwddp() {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url: '/pages/mypage/wodedianp'
				})
			},
			// 跳转我的订单
			tzwddd(value) {
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				if(value==1){
					uni.navigateTo({
						url: '/pages/mypage/wodedingd'
					})
				}else{
					uni.navigateTo({
						url: '/pages/mypage/wodedingdflq'
					})
				}
				
				
			},
			// 跳转我的关注
			tzwdgz() {
				uni.navigateTo({
					url: '/pages/mypage/wodeguanzhu'
				})
			},
			// 跳转修改信息页面
			tzgrxx() {
				
				uni.navigateTo({
					url: '/pages/mypage/gerenxinx'
				})
			},
			fuzhi() {
				let _this = this
				uni.setClipboardData({
					data: _this.personInfo.invite_code, //要被复制的内容
					success: () => { //复制成功的回调函数
						httpRequest.toast("复制成功")
					}
				});
			},
			login() {
				uni.navigateTo({
					url: "/pages/login/zhanghmmdl"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.beijingse1 {
		background: #FAFAFA;
		// position: absolute;
		width: 100%;
		box-sizing: border-box;
		// height: 100%;
		/* #ifdef APP-PLUS */
		padding-bottom: 114rpx;
		/* #endif */
	}
	.neirong {
		position: relative;
		top: -114rpx;
	}

	.xiahuax {
		padding-bottom: 30rpx;
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.03);
	}

	.tubiao {
		width: 40rpx;
		height: 40rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.fuzhi {
		width: 21rpx;
		height: 21rpx;
		background-size: 100% 100%;
		background-image: url('../../static/image/system/fuzhi.png');
	}

	.fwzxbtn {
		line-height: 26rpx;
		// width: 141rpx;
		font-size: 22rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-family: PingFang SC-Medium, PingFang SC;
		// font-weight: 500;
		color: #FFFFFF;
		// height: 36rpx;
		padding: 5rpx 30rpx;
		background: #FAB536;
		border-radius: 39rpx;
	}

	.righticon1 {
		width: 14rpx;
		background-size: 100% 100%;
		height: 30rpx;
		background-image: url('../../static/image/system/righticon.png');
	}

	.shilitu {
		width: 144rpx;
		height: 144rpx;
		border-radius: 50%;

		image {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
	}

	.tobejt {
		box-sizing: border-box;
		padding: 134rpx 30rpx 130rpx;
		width: 100%;
		background-size: 100% 100%;
		background-image: url('../../static/image/system/wdtb.png');
	}

	.bigtext1212 {
		color: #333;
		font-size: 40rpx;
		font-weight: bold;
	}
</style>
